package com.qf.controller;

import com.qf.pojo.Picture;
import com.qf.pojo.SchoolInfo;
import com.qf.service.SchoolService;
import com.qf.utils.ResultMsg;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/introduction")
public class SchoolController {
    @Autowired
    SchoolService schoolService;

    @GetMapping("/query")
    public ResultMsg query() {
        return schoolService.querySchoolInfo();
    }

    @PutMapping("/modify")
    public ResultMsg modify(@RequestBody SchoolInfo schoolInfo) {
        return schoolService.updateSchoolInfo(schoolInfo);
    }

    @GetMapping("/queryPic")
    public ResultMsg queryPic(@RequestParam(required = false) Integer pictureId) {
        return schoolService.queryPicture(pictureId);
    }

    @PutMapping("/insertPic")
    public ResultMsg insertPic(@RequestBody Picture picture) {
        return schoolService.insertPicture(picture);
    }

    @PutMapping("/updatePic")
    public ResultMsg updatePic(@RequestBody Picture picture) {
        return schoolService.updatePicture(picture);
    }

    @DeleteMapping("/deletePic")
    public ResultMsg deletePic(@RequestBody Picture picture) {
        return schoolService.deletePicture(picture.getPictureId());
    }
}
